<?php
$city = pods_url_variable('last');
$buzzr_cities = get_buzzr_cities();
$city_url = BUZZR_URL.'/coupons/'.$city;
$list_view_deal = new Pod('deal');
$where = "t.camp_end > ".fix_date()." && t.sale = 1 && t.coupon = 1 && city.name='".$city."'";
$list_view_deal->findRecords("id DESC", 15, $where);
?>
<div class="breadcrumb">
<ul>
       <li><a href="<?php echo BUZZR_URL; ?>" title="Buzzr.in">Home</a> >></li>
       <li><a href="<?php echo $city_url; ?>" title="<?php echo $city; ?>" ><?php echo ucwords($city); ?></a> >></li>
</ul>
</div>
<div class="clear"></div>
<h1 id="f_margin"><?php echo 'Coupons in '.ucwords($city); ?></h1>
<?php buzzr_fb_like(); ?>
<div class="clear"></div>
<div class="filter">
 <div class="city_select">Select City
	 <select name="city_select" onchange="window.location.href = this.value;">
	 	<?php foreach($buzzr_cities as $city_val){
           $citlink = BUZZR_URL.'/coupons/'.strtolower($city_val['name']);
           ?>
           <?php if(ucwords($city) == $city_val['name']){?>
           <option value="<?php echo $citlink; ?>" selected="selected"><?php echo $city_val['name']; ?></option>
           <?php }else{?>
	 	<option value="<?php echo $citlink; ?>"><?php echo $city_val['name']; ?></option>
	 	<?php } 
	 	}
	 	?>
	 </select>
  </div>
  
  <div class=views>
	  <a class="grid g-button">Grid View</a>
	  <a class="list g-button">List View</a>
  </div>
  
  <div class="sort">
	  <a class="g-button" href="<?php echo BUZZR_URL.'/coupons/online'; ?>">Online Coupons</a>
  </div>
  <div class="clear"></div>
</div>

<div id="list_wrap">
<ul class="list">
<?php echo $list_view_deal->showTemplate('list_grid'); ?>
</ul>
</div>
<div class="clear"></div>
<div>
<?php echo $list_view_deal->getPagination(); ?>
</div>